<?php

/**
 * Gifts form base class.
 *
 * @method Gifts getObject() Returns the current form's model object
 *
 * @package    explications_informatiques
 * @subpackage form
 * @author     Guimezanes Cyrille
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseGiftsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idgifts'       => new sfWidgetFormInputHidden(),
      'id_clientasso' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SfGuardUserProfile'), 'add_empty' => true)),
      'donneur'       => new sfWidgetFormInputText(),
      'response'      => new sfWidgetFormInputText(),
      'valeur'        => new sfWidgetFormInputText(),
      'date'          => new sfWidgetFormDateTime(),
      'email'         => new sfWidgetFormInputText(),
      'payeur_id'     => new sfWidgetFormInputText(),
      'currency'      => new sfWidgetFormInputText(),
      'resent'        => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'idgifts'       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idgifts')), 'empty_value' => $this->getObject()->get('idgifts'), 'required' => false)),
      'id_clientasso' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SfGuardUserProfile'), 'required' => false)),
      'donneur'       => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'response'      => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'valeur'        => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'date'          => new sfValidatorDateTime(array('required' => false)),
      'email'         => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'payeur_id'     => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'currency'      => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'resent'        => new sfValidatorString(array('max_length' => 45, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('gifts[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Gifts';
  }

}
